/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.espe.ccsoft.mantenimiento.modelos;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author misahaelfernandez
 */
@Entity
@Table(name = "MARCABUS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MarcaBus.findAll", query = "SELECT m FROM MarcaBus m")})
public class MarcaBus implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "COD_MARCABUS")
    private Integer codMarcabus;
    @Size(max = 16)
    @Column(name = "NOMBRE")
    private String nombre;
    @Size(max = 128)
    @Column(name = "DESCRIPCION")
    private String descripcion;
    @Column(name = "ESTADO")
    private Boolean estado;
    @OneToMany(mappedBy = "codMarcabus", fetch = FetchType.LAZY)
    private List<Unidad> unidadList;

    public MarcaBus() {
    }

    public MarcaBus(Integer codMarcabus) {
        this.codMarcabus = codMarcabus;
    }

    public Integer getCodMarcabus() {
        return codMarcabus;
    }

    public void setCodMarcabus(Integer codMarcabus) {
        this.codMarcabus = codMarcabus;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Boolean getEstado() {
        return estado;
    }

    public void setEstado(Boolean estado) {
        this.estado = estado;
    }

    @XmlTransient
    public List<Unidad> getUnidadList() {
        return unidadList;
    }

    public void setUnidadList(List<Unidad> unidadList) {
        this.unidadList = unidadList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codMarcabus != null ? codMarcabus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MarcaBus)) {
            return false;
        }
        MarcaBus other = (MarcaBus) object;
        if ((this.codMarcabus == null && other.codMarcabus != null) || (this.codMarcabus != null && !this.codMarcabus.equals(other.codMarcabus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ec.edu.espe.ccsoft.mantenimiento.modelos.MarcaBus[ codMarcabus=" + codMarcabus + " ]";
    }
    
}
